# config.py
import os


class Config:
    DIALECT = 'mysql'
    DRIVER = 'pymysql'
    USERNAME = 'root'
    PASSWORD = '1836815799xmz'
    HOST = 'localhost'
    PORT = '3306'
    DATABASE = 'flask_sql'
    SQLALCHEMY_DATABASE_URI = '{}+{}://{}:{}@{}:{}/{}?charset=utf8'.format(
        DIALECT,DRIVER,USERNAME,PASSWORD,HOST,PORT,DATABASE
    )
    SQLALCHEMY_COMMIT_ON_TEARDOWN = True
    SQLALCHEMY_TRACK_MODIFICATIONS = True
    SQLALCHEMY_ECHO = True
    SECRET_KEY = os.urandom(24)
    basedir = os.path.abspath(os.path.dirname(__file__))
    template_folder = 'app/templates'
    static_folder = 'app/static'
    # 用户头像
    User_Avatar_Dir = os.path.join(basedir, 'static/img/users_avatars/')
    User_Avatar_Size = {'small': 400,
                         'medium': 800}
    User_Avatar_Suffix = {
        User_Avatar_Size['small']: '_s',  # 导航栏
        User_Avatar_Size['medium']: '_m',  # 显示框
    }
    # DEBUG_TB_INTERCEPT_REDIRECTS = False    # 不想被flask debug toolbar拦截
    JSON_AS_ASCII = False
